package cn.edu.suda.schoolBus.controller;

import java.sql.Time;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.edu.suda.schoolBus.bean.CarNumber;
import cn.edu.suda.schoolBus.service.CarNumberService;
import cn.edu.suda.schoolBus.util.ResultUtil;

@Controller
public class CarNumberController {

	@Autowired
	private CarNumberService carNumberService;

	@RequestMapping("/addCarNumber")
	@ResponseBody
	public Map<String, Boolean> addCarNumber(CarNumber carNumber) {
		return ResultUtil.getResult(carNumberService.addCarNumber(carNumber));
	}

	@RequestMapping("/getCarNumber")
	@ResponseBody
	public Map<String, Object> getCarNumber(int page, int rows) {
		return carNumberService.getCarNumer(page, rows);
	}

	@RequestMapping("/getCarNumberByDepartureTime")
	@ResponseBody
	public Map<String, Boolean> getCarNumber(Time departureTime) {
		return ResultUtil.getResult(carNumberService.getCarNumber(departureTime));
	}

	@RequestMapping("/deleteCarNumber")
	@ResponseBody
	public Map<String, Boolean> deleteCarNumber(String ids) {
		return ResultUtil.getResult(carNumberService.deleteCarNumber(ids));
	}

	@RequestMapping("/editCarNumber")
	@ResponseBody
	public Map<String, Boolean> editCarNumber(CarNumber carNumber) {
		return ResultUtil.getResult(carNumberService.editCarNumber(carNumber));
	}

}
